<?php 
if($form->hasErrors()){
	$err_mess="alert('";
	$errors=$form->getErrors();
	foreach($errors as $error){
		$err_mess.=$error[0].'\n';
	}
	$err_mess.="');";
	$cs=Yii::app()->clientScript;
	$cs->registerScript('login_error',$err_mess);
	$form->clearErrors();
}
?>
<?php $this->pageTitle=Yii::app()->name . ' - 登录'; ?>

<h1 style="width:900px;margin:0 auto;padding-left:420px">登录</h1>

<div class="yiiForm"style="width:200px;margin:0 auto;">
<?php echo EHtml::beginForm(array('site/login_page')); 
EHtml::setOptions(array('errorElement'=> 'span',));	
?>

<?php echo CHtml::errorSummary($form); ?>

<div class="simple"style="padding:10px">
<?php echo CHtml::activeLabel($form,'username'); ?>
<?php echo EHtml::activeTextField($form,'username') ?>
</div>

<div class="simple"style="padding:10px">
<?php echo CHtml::activeLabel($form,'password'); ?>
<?php echo EHtml::activePasswordField($form,'password') ?>
</div>

<div class="action"style="padding:10px;margin-left:50px">
<?php echo EHtml::submitButton('登录'); ?>
</div>

<?php echo EHtml::endForm(); ?>

</div><!-- yiiForm -->